import { GithubSnippet, getSnippets } from "@/components/code";

export const PydanticPy = {
  path: "examples/pydantic/worker.py",
};

export const getStaticProps = ({}) => getSnippets([PydanticPy]);

# Pydantic Support

Hatchet allows for you to optionally validate workflow inputs and step outputs using [Pydantic](https://docs.pydantic.dev/latest/).

### Usage

To enable Pydantic for validation, you'll need to:

1. Provide an `input_validator` as a parameter to your `workflow`.
2. Add return type hints for your `steps`.

In addition, for improved IDE support and static type checking, you'll need to use `typing.cast` to cast the `workflow_input` and `step_output` to their correct type.

### Example Usage

<GithubSnippet src={PydanticPy} target="Pydantic" />
